#include <cstdio>
int main()
{
    int N,K;
    scanf("%d",&N);
    int score[101]={0};
    int sco;
    while(--N>=0)
    {
        scanf("%d",&sco);
        ++score[sco];
    }
    scanf("%d",&K);
    while(K--)
    {
        scanf("%d",&sco);
        printf("%d",score[sco]);
        if(K>0)putchar(' ');
    }
    putchar('\n');
    return 0;
}